/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2022 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define NUMLED_Pin GPIO_PIN_6
#define NUMLED_GPIO_Port GPIOF
#define CAPLED_Pin GPIO_PIN_7
#define CAPLED_GPIO_Port GPIOF
#define SCRLED_Pin GPIO_PIN_8
#define SCRLED_GPIO_Port GPIOF
#define ROW0_Pin GPIO_PIN_0
#define ROW0_GPIO_Port GPIOA
#define ROW1_Pin GPIO_PIN_1
#define ROW1_GPIO_Port GPIOA
#define ROW2_Pin GPIO_PIN_2
#define ROW2_GPIO_Port GPIOA
#define ROW3_Pin GPIO_PIN_3
#define ROW3_GPIO_Port GPIOA
#define ROW4_Pin GPIO_PIN_4
#define ROW4_GPIO_Port GPIOA
#define ROW5_Pin GPIO_PIN_4
#define ROW5_GPIO_Port GPIOC
#define COL0_Pin GPIO_PIN_10
#define COL0_GPIO_Port GPIOB
#define COL1_Pin GPIO_PIN_11
#define COL1_GPIO_Port GPIOB
#define COL2_Pin GPIO_PIN_12
#define COL2_GPIO_Port GPIOB
#define COL3_Pin GPIO_PIN_13
#define COL3_GPIO_Port GPIOB
#define COL4_Pin GPIO_PIN_14
#define COL4_GPIO_Port GPIOB
#define COL5_Pin GPIO_PIN_15
#define COL5_GPIO_Port GPIOB
#define COL8_Pin GPIO_PIN_8
#define COL8_GPIO_Port GPIOD
#define COL9_Pin GPIO_PIN_9
#define COL9_GPIO_Port GPIOD
#define COL10_Pin GPIO_PIN_10
#define COL10_GPIO_Port GPIOD
#define COL11_Pin GPIO_PIN_11
#define COL11_GPIO_Port GPIOD
#define COL12_Pin GPIO_PIN_12
#define COL12_GPIO_Port GPIOD
#define COL13_Pin GPIO_PIN_13
#define COL13_GPIO_Port GPIOD
#define COL14_Pin GPIO_PIN_14
#define COL14_GPIO_Port GPIOD
#define COL15_Pin GPIO_PIN_15
#define COL15_GPIO_Port GPIOD
#define LEFT_Pin GPIO_PIN_6
#define LEFT_GPIO_Port GPIOC
#define ATMode_Pin GPIO_PIN_7
#define ATMode_GPIO_Port GPIOC
#define WakeUp_Pin GPIO_PIN_8
#define WakeUp_GPIO_Port GPIOC
#define RIGHT_Pin GPIO_PIN_9
#define RIGHT_GPIO_Port GPIOC
#define USB_Pin GPIO_PIN_8
#define USB_GPIO_Port GPIOA
#define USB_EXTI_IRQn EXTI9_5_IRQn
#define BUZZ_Pin GPIO_PIN_10
#define BUZZ_GPIO_Port GPIOC
#define COL6_Pin GPIO_PIN_6
#define COL6_GPIO_Port GPIOD
#define COL7_Pin GPIO_PIN_7
#define COL7_GPIO_Port GPIOD
/* USER CODE BEGIN Private defines */
#define FALSE 0
#define TRUE 1 

#define CONFIGURED 1

#define ON 1
#define OFF 0

#define UNACTIVATED 0
#define ACTIVATED 1

extern uint8_t g_USBModeFlag;

extern volatile uint16_t tim8_counter;
extern volatile uint16_t tim7_counter;

extern unsigned char sleepTime50MsCounter;
extern uint32_t sleepTime1SCounter;

extern unsigned char USB_Receive_Buffer[64];
extern unsigned char USB_Received_Count;

extern uint8_t bDeviceState;

extern uint8_t Right_Flag;
extern uint8_t Left_Flag;

extern uint8_t count_time_1s_left;
extern uint8_t count_time_1s_right;

void Delay_us(uint32_t num);
void USB_Mode(void);
void BLUETEETH_Mode(void);

void Final_Function(void);
void HONG_CODE(void);
void COPY_PASTE(uint8_t* First,uint8_t* Second);

void Light_Function(void);

extern uint8_t Send_1[8];
extern uint8_t Send_2[8];
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
